<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript" src="/${initParam.context_root }/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function buyProduct(){
	window.open("${requestScope.pdto.productURL}", "${requestScope.pdto.productId}","width=700px, height=500px,  menubar=yes, status=yes, realzable=yes, location=yes, scrollbars=yes, toolbar=yes, resizable=yes");
}
</script>

<h2>상품명 : ${requestScope.pdto.productName }</h2><hr>
<img src="/${initParam.context_root }/upfile/${requestScope.pdto.productImageFilename}"><br>
<table >
	<tr align="left">	
		<td><font color="blue">상품명</font></td>
		<td>:</td>
		<td> ${requestScope.pdto.productName }</td>
	</tr>
	<tr align="left">
		<td><font color="blue">제품종류</font></td>
		<td>:</td>
		<td> ${requestScope.pdto.productCategory }</td>
	</tr>
	<tr align="left">
		<td><font color="blue">지역</font></td>
		<td>:</td>
		<td> ${requestScope.pdto.saleLocation }</td>
	</tr>
	<tr align="left">
		<td><font color="blue">사용기간</font></td>
		<td>:</td>
		<td> ${requestScope.pdto.useStartDate } ~ ${requestScope.pdto.useEndDate }</td>
	</tr>
	<tr align="left">
		<td><font color="blue">가격</font></td>
		<td>:</td>
		<td><strike> ${requestScope.pdto.originalPrice }원</strike><br>${requestScope.pdto.reducedPrice }원</td>
	</tr>
	<tr align="left">
		<td><font color="blue">할인율</font></td>
		<td>:</td>
		<td> ${requestScope.pdto.reducedRate }%</td>
	</tr>
	<tr align="left">
		<td><font color="blue">조회수</font></td>
		<td>:</td>
		<td> ${requestScope.pdto.readCnt }</td>
	</tr>
	<tr align="left">
		<td><br></td>
	</tr>
	<tr align="center">
		<td colspan="3"><font color="blue" style="">상품설명</font></td>
	</tr>
	<tr align="center">
		<td colspan="3">${requestScope.pdto.content }</td>
	</tr>
</table>
<br><br>
<hr>
<c:choose>
	<c:when test="${not empty sessionScope.memberDTO }">
		<input type="button" id="buyProduct" value="구매" onclick="buyProduct()">
		<input type="button" id="zzim" value="찜하기" onclick="location.href='/${initParam.context_root }/insertWish.do?productId=${requestScope.pdto.productId}'">	
	</c:when>
	<c:when test="${not empty sessionScope.companyDTO and sessionScope.companyDTO.id eq requestScope.pdto.companyId}">
		<input type="button" id="modify" value="수정" onclick="location.href='/${initParam.context_root }/modify_form.do?productId=${requestScope.pdto.productId}'">
		<input type="button" id="delete" value="삭제" onclick="location.href='/${initParam.context_root }/deleteProduct.do?productId=${requestScope.pdto.productId}'">
	</c:when>
	<c:when test="${not empty sessionScope.companbyDTO and sessionScope.companyDTO.id != requestScope.pdto.companyId}">
	</c:when>
	<c:when test="${not empty sessionScope.adminDTO}">
		<input type="button" id="modify" value="수정" onclick="location.href='/${initParam.context_root }/modify_form.do?productId=${requestScope.pdto.productId}'">
		<input type="button" id="delete" value="삭제" onclick="location.href='/${initParam.context_root }/deleteProduct.do?productId=${requestScope.pdto.productId}'">
	</c:when>
	<c:otherwise>
		<font color="red">로그인부터 하십시오..</font><br>
	</c:otherwise>
</c:choose>
	<input type="button" id="list" value="목록" onclick="location.href='/${initParam.context_root }/todayCoupon.do'">
	<input type="button" id="list" value="메인" onclick="location.href='/${initParam.context_root }/index.jsp'">